package com.sx.pipeline.adapter

import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.MessageTypeVo

/**
 * @Author：YY
 * @Date：2022/2/10
 * @Describe: 消息类型列表适配器
 */
class MessageTypeAdapter(
    dataList: MutableList<MessageTypeVo>,
) : BaseQuickAdapter<MessageTypeVo, BaseViewHolder>(
    R.layout.item_message_type, dataList
) {
    override fun convert(holder: BaseViewHolder, item: MessageTypeVo) {
        holder.setText(R.id.tv_title, item.name)
        var tvInvocation = holder.getView<TextView>(R.id.tv_involved_num)
        if (item.isNewNotification) {
            holder.setText(R.id.tv_content, context.getString(R.string.txt_new_message))
            holder.setText(R.id.tv_involved_num, item.noticeQty.toString())
            tvInvocation.visibility= View.VISIBLE
        } else {
            holder.setText(R.id.tv_content, context.getString(R.string.txt_no_message))
            tvInvocation.visibility= View.GONE
        }
    }
}